<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Tk_SetClass manual page - Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk C API</a> <small>&gt;</small> SetClass</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<H3><A NAME="M2">NAME</A></H3>
Tk_SetClass, Tk_Class &mdash; set or retrieve a window's class
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tk.h&gt;</B><BR>
<B>Tk_SetClass</B>(<I>tkwin, class</I>)<BR>
<A HREF="../TkLib/GetUid.htm">Tk_Uid</A><BR>
<B>Tk_Class</B>(<I>tkwin</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TkLib/WindowId.htm">Tk_Window</A> <B>tkwin</B> (in)<DD>
Token for window.
<P><DT>char <B>*class</B> (in)<DD>
New class name for window.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tk_SetClass</B> is called to associate a class with a particular
window.  The <I>class</I> string identifies the type of the
window;  all windows with the same general class of behavior
(button, menu, etc.) should have the same class.  By
convention all class names start with a capital letter, and
there exists a Tcl command with the same name as
each class (except all in lower-case) which can be used to
create and manipulate windows of that class.
A window's class string is initialized to NULL
when the window is created.
<P>
For main windows, Tk automatically propagates the name and class
to the WM_CLASS property used by window managers.  This happens
either when a main window is actually created (e.g. in
<B><A HREF="../TkLib/CrtWindow.htm">Tk_MakeWindowExist</A></B>), or when <B>Tk_SetClass</B>
is called, whichever occurs later.  If a main window has not been
assigned a class then Tk will not set the WM_CLASS property for
the window.
<P>
<B>Tk_Class</B> is a macro that returns the
current value of <I>tkwin</I>'s class.  The value is returned
as a <A HREF="../TkLib/GetUid.htm">Tk_Uid</A>, which may be used just like a string pointer but also has
the properties of a unique identifier (see the manual entry for
<B><A HREF="../TkLib/GetUid.htm">Tk_GetUid</A></B> for details).
If <I>tkwin</I> has not yet been given a class, then
<B>Tk_Class</B> will return NULL.
<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/C.htm#class">class</A>, <A href="../Keywords/U.htm#unique identifier">unique identifier</A>, <A href="../Keywords/W.htm#window">window</A>, <A href="../Keywords/W.htm#window manager">window manager</A>
<div class="copy">Copyright &copy; 1990 The Regents of the University of California.
<BR>Copyright &copy; 1994-1996 Sun Microsystems, Inc.
</div>
</BODY></HTML>
